package com.whale.cloud.util.rest.condition;

import com.whale.cloud.util.StringUtils;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by paco on 2017/06/09.
 */
public enum EColumnAuthority {
    create(1),
    createdate(2),
    modify(3),
    modifydate(4),
    search(5),
    item(6),
    itemdate(7);

    private static Map<String, EColumnAuthority> allEColumnAuthority = new HashMap<>();

    static {
        allEColumnAuthority.put("1", create);
        allEColumnAuthority.put("3", modify);
        allEColumnAuthority.put("5", search);
        allEColumnAuthority.put("6", item);
    }

    private int value;

    EColumnAuthority(int value) {
        this.value = value;
    }

    public static EColumnAuthority getEColumnAuthority(String code) {
        EColumnAuthority eca = null;
        if (StringUtils.isNull(code)) {
            return eca;
        }
        eca = allEColumnAuthority.get(code.trim());

        return eca;
    }

    public int getValue() {
        return this.value;
    }
}
